<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>在线充值</title>
    <link rel="stylesheet" type="text/css" href="../../../../css/aui/aui.css" />
    <style>
        html,
        body {
            background: #F7F7F7;
        }

        #app {
            padding: 1rem 0.75rem;
        }

        .list_wrap {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            margin-top: 1rem;
        }

        .list_item {
            width: calc(33.33% - 0.4rem);
            margin-right: 0.6rem;
            margin-bottom: 0.6rem;
            border: 1px solid #eee;
            box-sizing: border-box;
            text-align: center;
            padding: 0.5rem 0;
            border-radius: 0.3rem;
        }

        .list_item:nth-child(3n) {
            margin-right: 0;
        }

        .list_item.active {
            border-color: #0689FB;
            color: #0689FB;
        }

        .btn {
            background: #0689FB;
            width: 100%;
            height: 2rem;
            text-align: center;
            line-height: 2rem;
            color: #fff;
            margin: 2rem auto 0;
            border-radius: 0.2rem;
        }
    </style>
</head>

<body>
    <div id="app">
        <div>充值金额<small style="color:#999;"> (元)</small></div>
        <div class="list_wrap">
            <div class="list_item" v-for="o,i in list" :class="{active:i===active}" @click="selectMoney(o.recharge_money,i)">{{o.recharge_money}}</div>
            <div class="list_item" style="color:#999;" :class="{active:list.length===active}" @click="selectMoney('',list.length)">其他金额</div>
        </div>
        <div class="btn" @click="onlinePay()">立即充值</div>
    </div>
</body>
<script src="../../../../script/api.js" charset="utf-8"></script>
<script src="../../../../script/aui/aui-tab.js" charset="utf-8"></script>
<script src="../../../../script/common/jquery-3.3.1.min.js" charset="utf-8"></script>
<script src="../../../../script/common/common.js" charset="utf-8"></script>
<script src="../../../../script/common/config.js" charset="utf-8"></script>
<script src="../../../../script/common/vue.min.js" charset="utf-8"></script>
<script>
    apiready = function() {
        api.parseTapmode();
        vm.init();
    }

    var vm = new Vue({
        el: "#app",
        data: {
            list: [],
            active: '',
            money: '',
        },
        methods: {
            init() {
                this.getList();
            },
            getList() {
                var that = this;
                _ajax(Config.api.RechargeGetRechargePrice, {}, function(ret) {
                    if (ret.code === 200) {
                        that.list = ret.data;
                    }
                });
            },
            selectMoney(money, i) {
                this.active = i;
                this.money = money;
                if (money == '') {
                    this.onlinePay();
                }
            },
            qitaMonty() {
                this.active = '';
                this.money = '';
            },
            onlinePay() {
                var name = "online_pay_win";
                var url = "./online_pay_win.html";
                open_w(name, url, {
                    money: this.money
                });
            }
        }
    });
</script>

</html>
